package com.atguigu.gmall.ums.api;

import com.atguigu.gmall.common.bean.ResponseVo;
import com.atguigu.gmall.ums.entity.UserAddressEntity;
import com.atguigu.gmall.ums.entity.UserEntity;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @description:
 * @author: xie.zh
 * @create: 2021.03.29   01:22
 * @version: 1.0
 */
public interface GmallUmsApi {

    /**
     * 查询用户 比较密码是否一致
     *
     * @param loginName
     * @param password
     * @return
     */
    @GetMapping("ums/user/query")
    public ResponseVo<UserEntity> queryUser(@RequestParam("loginName") String loginName,
                                            @RequestParam("password") String password);

    /**
     * 实现用户数据的校验，主要包括对：手机号、用户名的唯一性校验
     *
     * @param data
     * @param type
     * @return
     */
    @GetMapping("ums/user/check/{data}/{type}")
    public ResponseVo<Boolean> checkData(@PathVariable("data") String data, @PathVariable("type") Integer type);

    /**
     * 发送验证码
     *
     * @param phone
     * @return
     */
    @PostMapping("ums/user/code")
    public ResponseVo getRandomCode(String phone);

    /**
     * 注册用户
     *
     * @param userEntity
     * @param code
     * @return
     */
    @PostMapping("ums/user/register")
    public ResponseVo register(UserEntity userEntity, @RequestParam("code") String code);

    /**
     * 用户信息
     */
    @GetMapping("ums/user/{id}")
    public ResponseVo<UserEntity> queryUserById(@PathVariable("id") Long id);

    /**
     * 查询用户地址信息
     * @param userId
     * @return
     */
    @GetMapping("ums/useraddress/user/{userId}")
    public ResponseVo<List<UserAddressEntity>> queryUserAddressesByUserId(@PathVariable("userId") Long userId);
}
